home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 1 / CU Amiga Magazine CD-ROM Special Edition (1995)(EMAP Images)(GB)[Issue 1995-11].iso / Aminet / comm / tcp / AmiTCPsdk_40.lha / AmiTCP-4.0 / netinclude / sys / syslog.h < prev    next >
C/C++ Source or Header  |  1994-10-05  |  5KB  |  150 lines

  1. #ifndef SYS_SYSLOG_H
  2. #define SYS_SYSLOG_H \
  3.        "$Id: syslog.h,v 4.2 1994/10/05 23:12:24 ppessi Exp $"
  4. /*
  5.  *      Syslog facilites and priorities
  6.  *
  7.  *      Copyright © 1994 AmiTCP/IP Group,
  8.  *                       Network Solutions Development, Inc.
  9.  *                       All rights reserved.
  10.  */
  11.  
  12. /*
  13.  * priorities/facilities are encoded into a single 32-bit quantity, where the
  14.  * bottom 3 bits are the priority (0-7) and the top 28 bits are the facility
  15.  * (0-big number).  Both the priorities and the facilities map roughly
  16.  * one-to-one to strings in the syslogd(8) source code.  This mapping is
  17.  * included in this file.
  18.  *
  19.  * priorities (these are ordered)
  20.  */
  21. #define    LOG_EMERG    0    /* system is unusable */
  22. #define    LOG_ALERT    1    /* action must be taken immediately */
  23. #define    LOG_CRIT    2    /* critical conditions */
  24. #define    LOG_ERR        3    /* error conditions */
  25. #define    LOG_WARNING    4    /* warning conditions */
  26. #define    LOG_NOTICE    5    /* normal but significant condition */
  27. #define    LOG_INFO    6    /* informational */
  28. #define    LOG_DEBUG    7    /* debug-level messages */
  29.  
  30. #define    LOG_PRIMASK    0x07    /* mask to extract priority part (internal) */
  31.                 /* extract priority */
  32. #define    LOG_PRI(p)    ((p) & LOG_PRIMASK)
  33. #define    LOG_MAKEPRI(fac, pri)    (((fac) << 3) | (pri))
  34.  
  35. #ifdef SYSLOG_NAMES
  36. #define    INTERNAL_NOPRI    0x10    /* the "no priority" priority */
  37.                 /* mark "facility" */
  38. #define    INTERNAL_MARK    LOG_MAKEPRI(LOG_NFACILITIES, 0)
  39. typedef struct _code {
  40.     char    *c_name;
  41.     int    c_val;
  42. } CODE;
  43.  
  44. CODE prioritynames[] = {
  45.     "alert",    LOG_ALERT,
  46.     "crit",        LOG_CRIT,
  47.     "debug",    LOG_DEBUG,
  48.     "emerg",    LOG_EMERG,
  49.     "err",        LOG_ERR,
  50.     "error",    LOG_ERR,        /* DEPRECATED */
  51.     "info",        LOG_INFO,
  52.     "none",        INTERNAL_NOPRI,        /* INTERNAL */
  53.     "notice",    LOG_NOTICE,
  54.     "panic",     LOG_EMERG,        /* DEPRECATED */
  55.     "warn",        LOG_WARNING,        /* DEPRECATED */
  56.     "warning",    LOG_WARNING,
  57.     NULL,        -1,
  58. };
  59. #endif
  60.  
  61. /* facility codes */
  62. #define    LOG_KERN    (0<<3)    /* kernel messages */
  63. #define    LOG_USER    (1<<3)    /* random user-level messages */
  64. #define    LOG_MAIL    (2<<3)    /* mail system */
  65. #define    LOG_DAEMON    (3<<3)    /* system daemons */
  66. #define    LOG_AUTH    (4<<3)    /* security/authorization messages */
  67. #define    LOG_SYSLOG    (5<<3)    /* messages generated internally by syslogd */
  68. #define    LOG_LPR        (6<<3)    /* line printer subsystem */
  69. #define    LOG_NEWS    (7<<3)    /* network news subsystem */
  70. #define    LOG_UUCP    (8<<3)    /* UUCP subsystem */
  71. #define    LOG_CRON    (9<<3)    /* clock daemon */
  72. #define    LOG_AUTHPRIV    (10<<3)    /* security/authorization messages (private) */
  73.  
  74.     /* other codes through 15 reserved for system use */
  75. #define    LOG_LOCAL0    (16<<3)    /* reserved for local use */
  76. #define    LOG_LOCAL1    (17<<3)    /* reserved for local use */
  77. #define    LOG_LOCAL2    (18<<3)    /* reserved for local use */
  78. #define    LOG_LOCAL3    (19<<3)    /* reserved for local use */
  79. #define    LOG_LOCAL4    (20<<3)    /* reserved for local use */
  80. #define    LOG_LOCAL5    (21<<3)    /* reserved for local use */
  81. #define    LOG_LOCAL6    (22<<3)    /* reserved for local use */
  82. #define    LOG_LOCAL7    (23<<3)    /* reserved for local use */
  83.  
  84. #define    LOG_NFACILITIES    24    /* current number of facilities */
  85. #define    LOG_FACMASK    0x03f8    /* mask to extract facility part */
  86.                 /* facility of pri */
  87. #define    LOG_FAC(p)    (((p) & LOG_FACMASK) >> 3)
  88.  
  89.  
  90. #ifdef SYSLOG_NAMES
  91. CODE facilitynames[] = {
  92.     "auth",        LOG_AUTH,
  93.     "authpriv",    LOG_AUTHPRIV,
  94.     "cron",     LOG_CRON,
  95.     "daemon",    LOG_DAEMON,
  96.     "kern",        LOG_KERN,
  97.     "lpr",        LOG_LPR,
  98.     "mail",        LOG_MAIL,
  99.     "mark",     INTERNAL_MARK,        /* INTERNAL */
  100.     "news",        LOG_NEWS,
  101.     "security",    LOG_AUTH,        /* DEPRECATED */
  102.     "syslog",    LOG_SYSLOG,
  103.     "user",        LOG_USER,
  104.     "uucp",        LOG_UUCP,
  105.     "local0",    LOG_LOCAL0,
  106.     "local1",    LOG_LOCAL1,
  107.     "local2",    LOG_LOCAL2,
  108.     "local3",    LOG_LOCAL3,
  109.     "local4",    LOG_LOCAL4,
  110.     "local5",    LOG_LOCAL5,
  111.     "local6",    LOG_LOCAL6,
  112.     "local7",    LOG_LOCAL7,
  113.     NULL,        -1,
  114. };
  115. #endif
  116.  
  117. /*
  118.  * arguments to setlogmask.
  119.  */
  120. #define    LOG_MASK(pri)    (1 << (pri))        /* mask for one priority */
  121. #define    LOG_UPTO(pri)    ((1 << ((pri)+1)) - 1)    /* all priorities through pri */
  122.  
  123. /*
  124.  * Option flags for openlog.
  125.  *
  126.  * LOG_ODELAY no longer does anything.
  127.  * LOG_NDELAY is the inverse of what it used to be.
  128.  */
  129. #define    LOG_PID        0x01    /* log the pid with each message */
  130. #define    LOG_CONS    0x02    /* log on the console if errors in sending */
  131. #define    LOG_ODELAY    0x04    /* delay open until first syslog() (default) */
  132. #define    LOG_NDELAY    0x08    /* don't delay open */
  133. #define    LOG_NOWAIT    0x10    /* don't wait for console forks: DEPRECATED */
  134. #define    LOG_PERROR    0x20    /* log to stderr as well */
  135.  
  136. #ifndef KERNEL
  137. void openlog(const char *, int, int);
  138. void closelog(void);
  139. int setlogmask(int);
  140. /*
  141.  * Include protos/inlines/pragmas for the syslog()
  142.  * (+ all other AmiTCP functions)
  143.  */
  144. #ifndef BSDSOCKET_H
  145. #include <bsdsocket.h>
  146. #endif
  147. #endif /* !KERNEL */
  148.  
  149. #endif /* !SYS_SYSLOG_H */
  150.